﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quartz;
using ZHDJ.Core.Log;
using ZHDJ.Data;
using ZHDJ.WinService.Util;

namespace ZHDJ.WinService.Job
{
    /// <summary>
    /// 统计访问数
    /// </summary>
    public class PartyVisitStatisticJob : JobBase
    {
        /// <summary>
        /// 执行业务锁
        /// </summary>
        private static Object BusinessLock = new Object();
        public override JobSetInfo JobSetInfo
        {
            get
            {
                return new JobSetInfo()
                {
                    JobGroup = "PartyVisitStatisticJobGroup",
                    JobName = "PartyVisitStatisticJob",
                    //
                    TriggerName = "PartyVisitStatisticJobTrigger",
                    Cron = ConfigHelper.PartyVisitStatisticJobIntervalCron
                };
            }
        }


        public override void RunBusiness(IJobExecutionContext context)
        {
            LogHelper.Info(ConfigHelper.PartyVisitStatisticJobIntervalCron, "PartyVisitStatisticJob");
            //LogHelper.Info("组织关系重置--开始");
            lock (BusinessLock)
            {

                LogHelper.Info("访问统计--开始", "PartyVisitStatisticJob");
                PartyOrg.RPartyVisitStatistic();
                LogHelper.Info("访问统计--结束", "PartyVisitStatisticJob");


            }
        }

    }
}
